package com.lianzhihui.romeex.ui.trade.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lianzhihui.romeex.R;
import com.lianzhihui.romeex.bean.ConversionConvetListBean;
import com.lianzhihui.romeex.utils.DateUtil;

import java.util.List;

/**
 * @ProjectName: romeex
 * @Package: com.lianzhihui.romeex.ui.trade.adapter
 * @ClassName: ExtractFragmentAdapter
 * @Description: java类作用描述
 * @Author: zhanghong
 * @CreateDate: 2020/10/30 17:38
 * @UpdateUser: 更新者：
 * @UpdateDate: 2020/10/30 17:38
 * @UpdateRemark: 更新说明：
 * @Version: 1.0
 */
public class ExchangeFragmentAdapter extends BaseQuickAdapter<ConversionConvetListBean.ContentBean, BaseViewHolder> {

    Context mContext;

    public ExchangeFragmentAdapter(@Nullable Context mContext, @Nullable List<ConversionConvetListBean.ContentBean> data) {
        super(R.layout.item_exchange_fragment, data);
        this.mContext = mContext;
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, ConversionConvetListBean.ContentBean item) {
        ImageView outIcon = helper.getView(R.id.iv_from);
        ImageView inIcon = helper.getView(R.id.iv_to);
        Glide.with(mContext).load(item.getOutIcon()).into(outIcon);
        Glide.with(mContext).load(item.getInIcon()).into(inIcon);
        helper.setText(R.id.timestamp, DateUtil.sec2Date(item.getTimeStamp()))
                .setText(R.id.tv_from, item.getSourceBalance() + item.getSourceCoinName())
                .setText(R.id.tv_to, item.getTargetBalance() + item.getTargetCoinName());

    }
}
